<?php
class GeradorAcao
{
	private $strCodigoClasse;

	function __construct($strAcao="Teste")
	{
		$arquivoModelo = fopen($strAcao.".php", "w");
		$this->iniciaClasseCabecalho();
		$this->criaConstrutor();
		$this->encerraClasse();
		fwrite($arquivoModelo, $this->strCodigoClasse);
		fclose($arquivoModelo);
		
		include $strAcao.".php";
		$objTeste = new $strAcao;
	}
	
	private function iniciaClasseCabecalho()
	{
		$this->strCodigoClasse = "<?php";
		$this->strCodigoClasse .= "\n class $strAcao";
		$this->strCodigoClasse .= "\n{";
	}
	
	private function criaPropriedades()
	{
		
	}
	
	private function criaConstrutor()
	{
		$this->strCodigoClasse .= "\n	function __construct()";
		$this->strCodigoClasse .= "\n	{";
		$this->strCodigoClasse .= "\n		echo 'teste2';";
		$this->strCodigoClasse .= "\n	}";
	}
	
	private function encerraClasse()
	{
		$this->strCodigoClasse .= "\n }";
		$this->strCodigoClasse .= "\n?>";
	}
}
$objGeradorAcao = new GeradorAcao();
?>